<template>
  <div class="module2">
    <div class="scroll" v-for="(item, index) in goodsList" :key="index">
      <div class="topic">{{ item.title }}</div>
      <div class="list">
        <img :src="`http://1.117.75.96:8080/goods/f${index + 1}.jpg`" alt="" />
        <ul class="f">
          <li v-for="val in item.goods" :key="val.gid" @click="cli(val.gid)">
            <div class="imgbox">
              <img v-lazy="val.gurl" alt="" />
            </div>
            <p class="goodsName">{{ val.type }}&nbsp;{{ val.model }}</p>
            <p class="txt">{{ val.tag }}</p>
            <p class="price">{{ val.gprice }}</p>
          </li>
        </ul>
      </div>
      <div class="blank" v-if="index == 0">
        <img src="http://1.117.75.96:8080/goods/gg3.jpg" alt="" />
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from "vue";
import { useRouter } from "vue-router";

let router = useRouter();
let props = defineProps(["goodsList"]);

//跳转
function cli(gid) {
  router.push({ name: "Goods", params: { id: gid } });
}
</script>

<style lang="less" scoped>
.module2 {
  padding: 30px 0;
  width: 100%;
  overflow: hidden;
  background-color: #f2f2f2;

  .scroll {
    margin-top: 10px;
    width: 1226px;
    margin: 0 auto;

    .topic {
      position: relative;
      font-size: 20px;
      line-height: 54px;
      color: #222;
      padding-left: 32px;
    }

    .topic::before {
      content: "";
      width: 4px;
      height: 20px;
      background: #00a8ff;
      position: absolute;
      left: 8px;
      top: 17px;
    }

    .list {
      zoom: 1;
      overflow: hidden;

      > img {
        width: 243px;
        height: 600px;
        float: left;
      }

      .f {
        width: 980px;
        height: 600px;
        padding-left: 3px;
        float: left;

        li {
          width: 233px;
          height: 290px;
          margin-left: 12px;
          margin-bottom: 20px;
          background: #fff;
          float: left;
          cursor: pointer;

          .imgbox {
            position: relative;
            width: 204px;
            height: 204px;
            margin: 0 auto;

            img {
              width: 100%;
              height: 100%;
            }
          }

          p {
            padding: 0 15px;
            line-height: 1;
            color: #999;
            text-align: center;
          }

          .goodsName {
            margin-top: 5px;
            margin-bottom: 8px;
            font-size: 20px;
            color: #222;
          }

          .txt {
            width: auto;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            word-wrap: normal;
          }

          .price {
            margin-top: 6px;
            font-size: 20px;
            font-size: 18px;
            color: #fe3350;
            width: auto;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            word-wrap: normal;
          }
        }
      }
    }

    .blank {
      display: block;
      height: 120px;
      margin-top: 30px;
      margin-bottom: 10px;

      img {
        width: 100%;
        height: 100%;
      }
    }
  }
}
</style>
